<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
        <style>
        </style>
    </head>
    <body>
        <!--<input type="button" value="DONT RUSH ME" id="btn"/>-->
        <script src="jquery-1.12.2.js"></script>
        <script>
            function Runinput(width,height,value){
                this.width = width || 200;
                this.height = height || 88;
                this.value = value || 'DONTRUSH';
            }
            /*
            * 创建按钮
            * map参数可定义父容器
            * */
            Runinput.prototype.createIn = function(map){
                map = map || 'body';
                var ele = $('<input width='+this.width+' height='+this.height+' value='+this.value+' type=button>').appendTo($(map));
                return ele;
            }
            //创建随机位置
            //参数为随机位置范围
            Runinput.prototype.randomPo = function(left,top){
                return {
                    'left': parseInt(Math.random()*left)+'px',
                    'top': parseInt(Math.random()*top)+'px'
                }
            }
            
            //创建点击事件
            Runinput.prototype.play = function(){
                console.log(this.randomPo());
                var that = this;
                var ele = this.createIn();
                ele.css('position','absolute')
                console.log(that);
                ele.click(function(){
                    ele.animate(that.randomPo(1000,700),666);
                });
            }
            var ntn = new Runinput();
            ntn.play();
        </script>
    </body>
</html>